//
//  DyCollectionViewCell.m
//  ChatDemo-UI2.0
//
//  Created by syun on 16/11/24.
//  Copyright © 2016年 syun. All rights reserved.
//

#import "DyCollectionViewCell.h"

@implementation DyCollectionViewCell



- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    
    if (self)
    {
        // 初始化时加载collectionCell.xib文件
        NSArray *arrayOfViews = [[NSBundle mainBundle] loadNibNamed:@"DyCollectionViewCell" owner:self options:nil];
        
        // 如果路径不存在，return nil
        if (arrayOfViews.count < 1)
        {
            return nil;
        }
        // 如果xib中view不属于UICollectionViewCell类，return nil
        if (![[arrayOfViews objectAtIndex:0] isKindOfClass:[UICollectionViewCell class]])
        {
            return nil;
        }
        // 加载nib
        self = [arrayOfViews objectAtIndex:0];
    }
    return self;
}

- (void)setDataForCellWith:(photoListModel *)model
{
    if (model.lastfileid.length>0) {
        
       NSString * imagePath = [NSString stringWithFormat:@"%@%@",PICPERFIXURL,model.lastfileid];
        [_photoImage sd_setImageWithURL:[NSURL URLWithString:imagePath] placeholderImage:[UIImage imageNamed:@"nopic_back"]];
    }
    
    
    _className.text = model.classname;
    
    _photoNum.text = [NSString stringWithFormat:@"%ld张",model.dynamiccount];

}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

@end
